import request from '@/utils/request'

export function getData(params) {
  return request({
    url: '/system/sellingPrice/listTable',
    method: 'get',
    params,
  })
}
export function sellingPrice(params) {
  return request({
    url: '/system/sellingPrice/all',
    params,
  })
}

export function delData(ids) {
  return request({
    url: `/system/sellingPrice/remove/${ ids }`,
    method: 'delete',
  })
}

export function editData(data) {
  return request({
    url: '/system/sellingPrice/edit',
    method: 'put',
    data,
  })
}

export function addData(data) {
  return request({
    url: '/system/sellingPrice/add',
    method: 'post',
    data,
  })
}

// 获取价格管理
export function getPricePartition(id, params) {
  return request({
    url: `system/pricePartition/list2/${ id }`,
    method: 'get',
    params,
  })
}
// 新增价格管理
export function addPricePartition(data) {
  return request({
    url: 'system/pricePartition/add',
    method: 'post',
    data,
  })
}
// 价格管理修改
export function editPricePartition(data) {
  return request({
    url: 'system/pricePartition/edit',
    method: 'put',
    data,
  })
}
// 价格管理删除
export function delPricePartition(ids) {
  return request({
    url: `system/pricePartition/${ ids }`,
    method: 'delete',
  })
}

// 价格管理批量修改
export function priceBatchAdd(data, id) {
  return request({
    url: `system/pricePartition/batchAdd/${ id }`,
    method: 'post',
    data,
  })
}
// 生成价格数据
export function copyCostPrice(id, params) {
  return request({
    url: `system/pricePartition/copyCostPrice/${ id }`,
    method: 'get',
    params,
  })
}
// 复制销售价格
export function copySellingPrice(id, params) {
  return request({
    url: `system/pricePartition/copySellingPrice/${ id }`,
    method: 'get',
    params,
  })
}

// 价格管理——查询
export function getSellingPriceSiteList(params) {
  return request({
    url: '/system/sellingPriceSite/selectSellingPriceSiteList',
    params,
  })
}

// 价格管理——详情
export function getPriceDetail(id) {
  return request({
    url: `/system/sellingPriceSite/${ id }`,
  })
}

// 价格管理——新增
export function addPriceDetail(data) {
  return request({
    url: 'system/sellingPriceSite/add',
    method: 'post',
    data,
  })
}

// 价格管理——修改
export function editPriceDetail(data) {
  return request({
    url: 'system/sellingPriceSite/edit',
    method: 'put',
    data,
  })
}

// 价格管理——删除
export function delPriceDetail(ids) {
  return request({
    url: `system/sellingPriceSite/remove/${ ids }`,
    method: 'delete',
  })
}
export const getAreaAndWareHouse = () => request({
  url: '/system/dept/areaAndWareHouse',
})
// 销售价审批发起
export const revocationProcess = data => request({
  url: '/activiti/salesPrice/revocationProcess',
  method: 'post',
  data,
  headers: { 'content-type': 'application/x-www-form-urlencoded' },
})
// 审批
export const approvalSalesPrice = data => request({
  url: '/activiti/salesPrice/approvalSalesPrice',
  method: 'post',
  data,
  headers: { 'content-type': 'application/x-www-form-urlencoded' },
})
// 销售价审批
export const actPrice = id => request({
  url: `system/pricePartition/actPrice/${ id }`,
})

// 价格管理——修改状态
export function editStatus(data) {
  return request({
    url: 'system/sellingPriceSite/editStatus',
    method: 'put',
    data,
  })
}
